#!/bin/sh
#######
# define
#######
host_dir=/media/sf_share/iosample
user_name=nato
group_name=nato

#
# copy host -> ubuntu
#
sudo find ${host_dir} -name ".svn" -type d -exec echo delete {} ";" -exec rm -rf {} ";"
sudo cp ${host_dir}/html -rf ./
sudo cp ${host_dir}/server -rf ./
sudo chown ${user_name}:${group_name} ./ -R

#
# build
#

########################
# javascript
########################
cat \
./html/js/Common.coffee \
./html/js/UserInfo.coffee \
./html/js/Tune.coffee \
./html/js/TuneList.coffee \
./html/js/StreamingPacket.coffee \
./html/js/Player.coffee \
./html/js/W3CPlayer.coffee \
./html/js/MozillaPlayer.coffee \
./html/js/PlayerFactory.coffee \
./html/js/Controller.coffee \
./html/js/Main.coffee \
> ./html/js/streamer.coffee
#coffee -c ./html/js/streamer.coffee
coffee -c -b ./html/js/streamer.coffee
#-b option for testing

# copy to javascript specs target source folder
cp ./html/js/streamer.js ./html/js_test/src/streamer.js

# build specs
coffee -c -b ./html/js_test/spec/*.coffee

########################
# html 
########################
haml -f html5 ./html/index.haml ./html/index.html 

#
# copy ubunt -> host
#
sudo cp html -rf ${host_dir}

sudo find ${host_dir} -name ".svn" -type d -exec echo delete {} ";" -exec rm -rf {} ";"

#
# javascript lint
#
gjslint  -r ./html/js
